﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Dynamic;
using System.Web;
using System.Web.Mvc;
using SDT.Model;
using SDT.Lib.Paging;
using SDT.Site.ViewModels;
using SDT.Site.Properties;

namespace SDT.Site.Controllers
{
    public class QuestionCategoryController : Controller
    {
        SDTDataContext eDataContext = new SDTDataContext();
        //
        // GET: /QuestionCategory/

        public ActionResult Index()
        {
            return View();
        }

        /// <summary>
        /// Author: Takamaru Nguyen
        /// Date: 19/07/2011
        /// </summary>
        /// <returns></returns>
        [ChildActionOnly]
        public ActionResult Lasted(int id, string title)
        {
            string order = "ID desc";
            var cats= eDataContext.QuestionCategories.OrderBy(string.Format("{0}", order)).ToList();
            QuestionCategoryViewModels q = new QuestionCategoryViewModels();
            q.Categories = cats;
            q.CategoryID = id;
            ViewData["Title"] = title;
            return View(q);
        }
    }
}
